// Implement your domain here using the SJS DSL.

paramSet 'descriptorTypes', enumName:'DESCRIPTOR_TYPES', mandatory:true, values:[
	'STRING',
	'REF',
	'DATE',
	'TIME',
	'DATE_TIME',
	'DURATION',
	'INTEGER',
	'DECIMAL',
	'ENUMERATION',
	'LIST',
	'BINARY',
	'BOOL',
	'PERCENT'], defaultValue:'STRING'

paramSet 'ioTypes', enumName:'INPUT_TYPES', mandatory:true, values:[
	'CONTEXT',
	'ACTION_PARAMETER'
	], defaultValue:'CONTEXT'


Entity('TestEntity', extension:'TestEntityExtension', rendered:['displayable', 'testScope', 'generatedEntity', 'resultEntity']) {
	string		'nickName'
	string 		'displayable', computed:true
	any			'entityId', class:'java.io.Serializable', unicityScope:'testEntityUnq'
	any 		'entitySerialized', class:'java.lang.String'
	any 		'clazzName', class:'java.lang.String', unicityScope:'testEntityUnq'
	any 		'clazz', class:'java.lang.Class', computed:true
	reference	'testScope', ref:'TestScope', unicityScope:'testEntityUnq'
	bool		'resultEntity', defaultValue:false
	bool		'generatedEntity', defaultValue:false			
	any			'value', class:'org.jspresso.framework.model.component.IComponent', computed:true
}


Entity('TestScope', extension:'TestScopeExtension', services:['TestScopeService':'TestScopeServiceDelegate'], toString:'displayableName') {
	string		'displayableName', computed:true
	string_512 	'userName', unicityScope:'testScopeUnq'
	string_512	'scopeId', unicityScope:'testScopeUnq'
}

Entity('BackActionTest', processor:'BackActionTestProcessors', interceptors:['BackActionTestInterceptors'], extension:'BackActionTestExtension', services:['BackActionTestService':'BackActionTestServiceDelegate']) {
	string_256 	'backendBeanName'
	string_1024	'description'
	reference 	'testScope', ref:'TestScope', processors:['TestScopeProcessor'], mandatory:true
	list		'inputs', ref:'ActionTestInput'
	list		'outputs', ref:'ActionTestOutput'
	list		'testOutputs', ref:'ActionTestOutput', computed:true
	
	reference 	'nextAction', ref:'BackActionTest'
	reference	'prevAction', ref:'BackActionTest', reverse:'BackActionTest-nextAction'
}

Entity('ActionTestIo', processor:'ActionTestIoProcessors', extension:'ActionTestIoExtension') {
	string_256	'parameterKey'
	text_1024	'description'
	enumeration	'parameterType', paramSets:['descriptorTypes'], processors:['ParameterTypeProcessor']
	enumeration	'ioType', paramSets:['ioTypes']
	bool		'sql', booleanWritabilityGates:['!prevOutputAsSource']
	bool		'prevOutputAsSource', processors:['SetPreviousOutputAsSourceProcessor']
	string_256	'prevOutputParameterKey', booleanWritabilityGates:['prevOutputAsSource']
	reference 	'parameterRefValue', ref:'TestEntity', booleanWritabilityGates:['!prevOutputAsSource']
	list	 	'parameterRefValues', ref:'TestEntity', manyToMany:true
	any			'parameterScalarValue', class:'java.lang.Object', computed:true, delegateWritable:true, booleanWritabilityGates:['!prevOutputAsSource']
	string_2048	'parameterSqlValue', booleanWritabilityGates:['!prevOutputAsSource']
	bool		'visible', defaultValue:true
	string		'parameterScalarValueDisplayable', computed:true
	reference	'backActionTest', ref:'BackActionTest', computedFurther:true
}

Entity('ActionTestOutput', extension:'ActionTestOutputExtension', extend:['ActionTestIo']) {
	reference 	'backActionTestRef', ref:'BackActionTest', reverse:'BackActionTest-outputs'
	reference	'backActionTest', ref:'BackActionTest', computed:true
	bool		'lastExecutionSuccessfull', defaultValue:false
	reference	'result', ref:'TestEntity'
}

Entity('ActionTestInput', extension:'ActionTestInputExtension', extend:['ActionTestIo']) {
	reference 	'backActionTestRef', ref:'BackActionTest', reverse:'BackActionTest-inputs'
	reference	'backActionTest', ref:'BackActionTest', computed:true
}

Entity('BackActionTestTemplate', extend:['BackActionTest'])

Entity('TestCase') {
  
}


Component('EntityDescriptorPicker') {
	list 'descriptors', ref:'EntityDescriptor'
}

Component('TestEntityPicker') {
	list 'testEntities', ref:'TestEntity'
}

Component('EntityDescriptor', extension:'EntityDescriptorExtension', rendered:['displayable']) {
	any 		'descriptor', class:'org.jspresso.framework.model.descriptor.IComponentDescriptor'
	string		'displayable', computed:true
}




Component('Address') {
	string_30 	'street'
	string_10 	'number'
	reference 	'gpsLocation', ref:'GpsLocation'
	
}

Component('GpsLocation') {
	integer 	'latitude'
	integer 	'longitude'
}

Interface('IPropertiesExludable', services:['IPropertiesExludableService':'IPropertiesExludableServiceDelegate']) {
}

Interface('ITraceable', extend:['IPropertiesExludable']) {
	date_time 	'createdTimestamp'
}

Entity('Segment', extension:'SegmentExtension', extend:['ITraceable'], toString:'displayableName') {
	string 		'displayableName', computed:true
	reference 	'departure', ref:'Node'
	reference 	'arrival', ref:'Node'
}


Entity('Voyage', extend:['ITraceable']) {
	string_64 	'ref'
	reference 	'destination', ref:'Node'
	list 		'segments', ref:'Segment', manyToMany:true
}


Entity('Node', extend:['ITraceable']) {
	string_32 	'name'
	reference 	'address', ref:'Address'
}


Component('RepeaterComponent') {
  any  'components', class:'java.util.ArrayList', computed:true
}